<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<%@ include file="../perEvaluationResult/importhead.jsp" %>
<%@ page import="java.text.*" %>
<%
	String id = request.getParameter("id");
	int checkid = Integer.parseInt(id);
	VCheckReport checkreprot = DAOFactory.getCheckReportDAO().getVCheckReportByID(checkid);
	List<TCheckReportItem> list = DAOFactory.getCheckReoprtItemDAO().getCheckReportItemsByCheckID(checkid);
	//out.println(list.size());
	request.setAttribute("report", checkreprot);
	request.setAttribute("itemlist", list);
	Format f = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
	Date d = (Date)f.parseObject(checkreprot.getChecktime());
	Format f2 = new SimpleDateFormat("yyyyMMdd");
	String checkdate = f2.format(d);
 %>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <script src="https://code.jquery.com/jquery-3.3.1.min.js"></script>
    <script src="../js/jsuntil/FileSaver.js"></script>
    <script src="../js/jsuntil/jquery.wordexport.js"></script>
    <style>
        body{
            font-family: 宋体;
            font-size: 12px;
            padding-bottom:20px;
        }
        table,tr,td{
            padding: 0;
            height: 28px;
        }
        .weidu{
            margin-top: 20px;
        }
        
        .MsoNormalTable{
            mso-style-name:普通表格;
            mso-style-parent:"";
            mso-style-noshow:yes;
            mso-tstyle-rowband-size:0;
            mso-tstyle-colband-size:0;
            mso-padding-alt:0.0000pt 5.4000pt 0.0000pt 5.4000pt;
            mso-para-margin:0pt;
            mso-para-margin-bottom:.0001pt;
            mso-pagination:widow-orphan;
            font-family:'Times New Roman';
            font-size:10.0000pt;
            mso-ansi-language:#0400;
            mso-fareast-language:#0400;
            mso-bidi-language:#0400;
        }
    </style>
</head>
<body>
    <input type="button" value="保存为Word" onclick="toWord();">
    <div id="export_word" style="margin:auto;width:90%;">
        <div style="text-align:center;height:30px;line-height:30px;">
        	<c:if test="${report.checktypeid == 2 }">
        		<h2>个性特征分析（MHT）</h2> 
        	</c:if>
        	<c:if test="${report.checktypeid == 1 }">
        		<h2>个性特征分析（EPQ）</h2> 
        	</c:if>
            
        </div> 
        <div>
            <table style="text-align: center; border-collapse:collapse;width:100%;mso-table-layout-alt:fixed;border:none;mso-border-left-alt:0.5000pt solid windowtext;mso-border-top-alt:0.5000pt solid windowtext;mso-border-right-alt:0.5000pt solid windowtext;mso-border-bottom-alt:0.5000pt solid windowtext;mso-border-insideh:0.5000pt solid windowtext;mso-border-insidev:0.5000pt solid windowtext;mso-padding-alt:0.0000pt 5.4000pt 0.0000pt 5.4000pt ;" class="MsoNormalTable" border="1">
                <tr>
                    <td style="width:20%">施测次数</td>
                    <td style="width:40%" colspan="3">第一次施测</td>
                    <td style="width:40%;" colspan="3">第二次施测</td>
                </tr>
                <tr>
                    <td>施测时间</td>
                    <td colspan="3">${report.checktime }</td>
                    <td colspan="3"></td>
                </tr>
                <tr>
                    <td>分量表名称</td>
                    <td>原始分</td>
                    <td>T分</td>
                    <td>分析</td>
                    <td>原始分</td>
                    <td>T分</td>
                    <td>分析</td>
                </tr>
             <c:forEach items="${itemlist}" var="obj">
                <tr>
                    <td>${obj.itemname }</td>
                    <td>${obj.originalscore }</td>
                    <td>${obj.standardscore }</td>
                    <td>${obj.status }</td>
                    <td></td>
                    <td></td>
                    <td></td>
                </tr>
              </c:forEach>  
              
              <% 
              	String resultintro = "",suggestion=""; 
              	List list1 = (List)request.getAttribute("itemlist");
              	for(int i=0;i<list1.size();i++){
              		TCheckReportItem item = (TCheckReportItem)list1.get(i);
              		resultintro += item.getResultintro()+",";
              		suggestion += item.getSuggestion() +",";
              	}
              %>
               
                <tr style="height:200px;">
                    <td>个性特征分析</td>
                    <td colspan="3" style="vertical-align:bottom">
                    <%=resultintro %><br>
                        签定人：
                    </td>
                    <td colspan="3" style="vertical-align:bottom">
                        签定人：
                    </td>
                </tr>
                <tr style="height:200px;">
                    <td>教育建议</td>
                    <td colspan="3" style="vertical-align:top">
                    <%=suggestion %>  
                    </td>
                    <td colspan="3" style="vertical-align:top">
                        
                    </td>
                </tr>
            </table>
        </div>
    </div>
</body>
<script>
    function toWord(){
        $("#export_word").wordExport("<%=checkreprot.getCheckname() %>"+"-"+"<%=checkreprot.getRealName()%>" + "_"+"<%=checkdate%>");
    }
    
     $(function () {
		$('tr[style!="height:200px;"]').css('height',38);
	})
</script>
</html>